﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using DBLibrary;

public partial class masterPages_main_MainDefault : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        KeyDetail kd = PoseidonDBHelper.AdminDB.Select<KeyDetail>(new DBParam("DBPre", this.Session.GetUserDBPrefix()))[0];
        if ((kd.UsageType & KeyUsageType.Temporary) == KeyUsageType.Temporary)
        {
            AdminDBDetail admin = PoseidonDBHelper.AdminDB.Select<AdminDBDetail>(new DBParam("DBPre", kd.DBPre))[0];
            KeyContent kc = kd.KeyContent;
            TimeSpan ts = kc.ExpireTime - kc.StartTime;
            DaysLeft.Text = ts.Days.ToString();
            DaysLeftPanel.Visible = true;
        }
        else
        {
            DaysLeftPanel.Visible = false;
        }
    }
}